package sfin.swt.util;


public class IconCredit {

	private String link;
	private String name;
	private String resources = "";
	
	public IconCredit readHeader(String header){
		String[] splitted = header.substring(1).split("\\|");
		link = splitted[0];
		try{
			name = splitted[1];
		}catch(ArrayIndexOutOfBoundsException e){
			e.printStackTrace();
		}
		return this;
	}

	public String getLink() {
		return link;
	}
	
	public String getName() {
		return name;
	}
	public String getResources() {
		return resources;
	}
	
	public void addResource(String resource, boolean wrap){
		if(resources == null)
			resources = "";
		resources+=resource + ",";
		if(wrap)
			resources += "\n";
	}
	
	public void end(){
		resources = resources.substring(0, resources.length() - 2);
	}

}
